package com.shangcheng.server.controller;

import com.shangcheng.model.domain.PrefrenceArea;
import com.shangcheng.model.vo.result.Result;
import com.shangcheng.server.service.PrefrenceAreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author JavaClimber
 * @version 1.0
 * @date 2022/5/12 0012 zihao
 * 获取所有商品优选
 */
@RestController
@RequestMapping("/prefrenceArea")
public class PrefrenceAreaController {
    @Autowired
    private PrefrenceAreaService prefrenceAreaService;

    @GetMapping("/listAll")
    public ResponseEntity listAll(){
        //调用service
        List<PrefrenceArea> prefrenceArea = prefrenceAreaService.listAll();
        //返回对象
        Result result =new Result();
        result.setCode(200);
        result.setData(prefrenceArea);
        return ResponseEntity.ok(result);
    }

}
